//
//  CommentsViewController.m
//  DefendHealth
//
//  Created by 吾诺翰卓003 on 17/2/23.
//  Copyright © 2017年 iMacOne. All rights reserved.
//

#import "CommentsViewController.h"
#import "CommentsTableViewCell.h"
@interface CommentsViewController ()

@end

@implementation CommentsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.TitleNav.hidden = YES;
    
    UIImageView *searchImg = [UIImageView new];
    searchImg.frame = CGRectMake(WindowWidth-10-18, 25, 18, 20);
    searchImg.image = [UIImage imageNamed:@"search"];
    [self.view addSubview:searchImg];
    
    UILabel *lab1 = [UILabel new];
    lab1.frame = CGRectMake(WindowWidth-10-18-12-30+4, 30, 30, 10);
    lab1.text = @"999";
    lab1.font = FONT(13);
    lab1.textColor = UIColorFromRGB(0x333333);
    lab1.textAlignment = 0;
    [self.view addSubview:lab1];
    
    UIImageView *starImg = [UIImageView new];
    starImg.frame = CGRectMake(WindowWidth-10-18-12-30-22, 25, 22, 20);
    starImg.image = [UIImage imageNamed:@"collection"];
    [self.view addSubview:starImg];
    self.baseTableView.frame = CGRectMake(0, 64, WindowWidth, WindowHeight-64-53);
    self.baseTableView.backgroundColor = [UIColor whiteColor];
    
    [self addHeadView];
    [self addDiBuView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(void)addHeadView{
    UIView *headView1 = [UIView new];
    
    headView1.backgroundColor = [UIColor whiteColor];
    
    
    UIImageView *img = [UIImageView new];
    img.frame = CGRectMake(12, 0, WindowWidth-24, 145);
    img.backgroundColor = [UIColor grayColor];
    [headView1 addSubview:img];
    
    UILabel *lab1 = [UILabel new];
    lab1.frame = CGRectMake(10, kMaxY(img.frame)+15, WindowWidth-20, 35);
    lab1.text = @"内咖啡：当你学会享受健身的快感，减肥已经成功了一半";
    lab1.font = FONT(14);
    lab1.textColor = UIColorFromRGB(0x000000);
    lab1.textAlignment = 0;
    lab1.numberOfLines = 2;
    [headView1 addSubview:lab1];
    
    UIImageView *touxiang = [UIImageView new];
    touxiang.frame = CGRectMake(10, kMaxY(lab1.frame)+17, 36, 36);
    touxiang.layer.cornerRadius = 18;
    touxiang.layer.masksToBounds = YES;
    touxiang.backgroundColor = [UIColor grayColor];
    [headView1 addSubview:touxiang];
    
    UILabel *nameLab1 = [UILabel new];
    nameLab1.frame = CGRectMake(kMaxX(touxiang.frame)+12, kMaxY(lab1.frame)+17+2, [ToolUtil autoWidth:@"MDK" width:500 height:13 num:13], 13);
    nameLab1.text = @"MDK";
    nameLab1.font = FONT(13);
    nameLab1.textColor = UIColorFromRGB(0x000000);
    nameLab1.textAlignment = 0;
    [headView1 addSubview:nameLab1];
    
    UIButton *focusBtn1 = [[UIButton alloc] initWithFrame:CGRectMake(kMaxX(nameLab1.frame)+12, kMaxY(lab1.frame)+17, 54, 15)];
    [focusBtn1 setTitle:@"关注" forState:UIControlStateNormal];
//    [focusBtn1 addTarget:self action:@selector(shenqingVip) forControlEvents:UIControlEventTouchUpInside];
    focusBtn1.titleLabel.font = FONT(10);
    focusBtn1.layer.cornerRadius = 7.5;
    focusBtn1.layer.masksToBounds = YES;
    focusBtn1.backgroundColor = [UIColor grayColor];
    [focusBtn1 setTitleColor:[ImageUtil colorWithRgb:0x463d3b] forState:0];
    [headView1 addSubview:focusBtn1];
    
    UILabel *contentLab1 = [UILabel new];
    contentLab1.frame = CGRectMake(kMaxX(touxiang.frame)+12, kMaxY(nameLab1.frame)+12, WindowWidth-(kMaxX(touxiang.frame)+12), 10);
    contentLab1.text = @"天下无敌MDK";
    contentLab1.font = FONT(10);
    contentLab1.textColor = UIColorFromRGB(0x797b7b);
    contentLab1.textAlignment = 0;
    [headView1 addSubview:contentLab1];
    
    headView1.frame = CGRectMake(0, 0,WindowWidth , kMaxY(contentLab1.frame));
    self.baseTableView.tableHeaderView = headView1;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 194;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString * cellIden = @"CommentsTableViewCell";
    CommentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIden];
    if (cell == nil) {
        cell = [[CommentsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIden];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.backgroundColor = [UIColor whiteColor];
    return cell;
}
-(void)addDiBuView{
    UIView *view1 = [UIView new];
    view1.frame = CGRectMake(0, WindowHeight-53,WindowWidth , 53);
    view1.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view1];
    
    UIView *hui = [UIView new];
    hui.frame = CGRectMake(12, 0,WindowWidth-24 , 0.5);
    hui.backgroundColor = kLineColor;
    [view1 addSubview:hui];
    
    UIImageView *zan = [UIImageView new];
    zan.frame = CGRectMake(WindowWidth-10-19, 17.5, 19, 18);
    zan.image = [UIImage imageNamed:@"praise"];
    [view1 addSubview:zan];
    
    UIImageView *comment = [UIImageView new];
    comment.frame = CGRectMake(WindowWidth-10-19-25-15, 19.5, 15, 14);
    comment.image = [UIImage imageNamed:@"comment"];
    [view1 addSubview:comment];
    
    UITextField * nameTf = [UITextField new];
    nameTf.frame = CGRectMake(10, 12.5, WindowWidth-25-19-25-15-12-25, 28);
    nameTf.delegate = self;
    [view1 addSubview:nameTf];
    nameTf.font = FONT(14);
    nameTf.placeholder = @" 点击评论";
    nameTf.layer.borderWidth = 1.5;
    nameTf.layer.borderColor = UIColorFromRGB(0xf1f1f1).CGColor;
}
@end
